package com.hqyj.pojo;

import com.baomidou.mybatisplus.annotation.IdType;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;

import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 * 
 * </p>
 *
 * @author rock
 * @since 2021-10-20
 */
@Data
@TableName("attendance_sheet")
@EqualsAndHashCode(callSuper = false)
public class AttendanceSheet extends MyPage implements Serializable {

    private static final long serialVersionUID=1L;

    @TableId(value = "attendance_id", type = IdType.AUTO)
    private Integer attendanceId;

    @TableField(value = "employee_id")
    private Integer employeeId;

    @TableField(value = "type")
    private String type;

    @TableField(value = "reward_punishmen_money")
    private String rewardPunishmenMoney;

    @TableField(value = "attendance_person")
    private String attendancePerson;

    @TableField(value = "attendance_date")
    private Date attendanceDate;


    @Override
    public String toString() {
        return "AttendanceSheet{" +
                "attendanceId=" + attendanceId +
                ", employeeId=" + employeeId +
                ", type='" + type + '\'' +
                ", rewardPunishmenMoney='" + rewardPunishmenMoney + '\'' +
                ", attendancePerson='" + attendancePerson + '\'' +
                ", attendanceDate=" + attendanceDate +
                ", jiangfa=" + jiangfa +
                ", num=" + num +
                '}';
    }

//    public String getBirthday() {
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//        if(this.birthday!=null){
//            return sdf.format(this.birthday);
//        }
//        return "";
//    }
//
//    public void setBirthday(String birthday) {
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//
//        try {
//            this.birthday = sdf.parse(birthday);
//        } catch (ParseException e) {
//            e.printStackTrace();
//        }


    public void setAttendanceDate(String attendanceDate) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

        try {
            this.attendanceDate = sdf.parse(attendanceDate);
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }
    public String getAttendanceDate(){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        if (this.attendanceDate != null){
            return sdf.format(this.attendanceDate);
        }
        return "";
    }
}
